import 'dart:convert';
import 'dart:io';

import 'package:flutter/cupertino.dart';

class NetUtil {
  String url;

  NetUtil(this.url);

  Future<String> pullData() async {
    try {
      HttpClient httpClient = HttpClient();
      HttpClientRequest request = await httpClient.getUrl(Uri.parse(url));
      HttpClientResponse response = await request.close();
      String responseContent = await response.transform(utf8.decoder).join();
      httpClient.close();
      return responseContent;
    } catch (e) {
      debugPrint(e.toString());
      return "";
    }
  }
}

class Host {
  static String toutiao = "http://v.juhe.cn/toutiao/index";
}
